import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'
import IndexView from "@/views/IndexView.vue";
import ZhanghaoView from "@/views/ZhanghaoView.vue";
import ZhanginfoView from "@/views/ZhanginfoView.vue";
import NewlistView from "@/views/NewlistView.vue";
import FeedbackView from "@/views/FeedbackView.vue";
import DrafView from "@/views/DrafView.vue";
import publisher from "@/publisher.vue";
import DraftsBox from "@/lei/DraftsBox.vue";
import EditBox from "@/lei/EditBox.vue";
import QuillEditor from "@/lei/QuillEditor.vue";

import VueQuillEditor from 'vue-quill-editor';
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'

import Quill from 'quill';
import imageResize  from 'quill-image-resize-module' // 调整大小组件。
import { ImageDrop } from 'quill-image-drop-module';
import NewsDatil from "@/liu/NewsDatil.vue";
import FeedbackPage from "@/liu/FeedbackPage.vue";
import HomePage from "@/liu/HomePage.vue"; // 拖动加载图片组件。
Quill.register('modules/imageResize', imageResize );
Quill.register('modules/imageDrop', ImageDrop);

// 首页
import index from '@/views/index';
/**
 * 基础菜单
 */
// 用户管理
import User from '@/views/user/user';
/**
 * 新闻管理
 */
// 新闻
import News from '@/views/news/news';
/**
 * 评论管理
 */
// 评论
import Comment from '@/views/comment/comment';


Vue.use(VueQuillEditor)

Vue.use(VueRouter)



const routes = [
  {
    path: '/index',
    name: '首页',
    component: index,
    iconCls: 'el-icon-tickets',
    children: [{
        path: '/user/user',
        name: '用户管理',
        component: User,
        meta: {
            requireAuth: true
        }
    }, {
        path: '/news/news',
        name: '用户管理',
        component: News,
        meta: {
            requireAuth: true
        }
    }, {
        path: '/comment/comment',
        name: '评论管理',
        component: Comment,
        meta: {
            requireAuth: true
        }
    },

    ]
},
  
  {
    path: '/homepage',
    name:'HomePage',
    component:  () => import('../components/HomePage.vue')
  },
  {path: '/mypage',
  name: 'MyPage',
    component:  () => import('../components/MyPage.vue'),
    meta: {
      requireAuth: true // 需要验证登录状态
    }
  },
  {
    path: '',
    name:'MyLogin',
    component: () => import('../components/MyLogin.vue')
  },
  {
    path: '/register',
    component: () => import('../components/MyRegister.vue')
  },
  {
    path: '/error',
    name: 'Error',
    component: () => import('../components/Error.vue')
  },
  {
  path: '/publisher',
  name:'publisher',
    component: publisher,
    children: [
  {
    path: 'home',
    name: 'home',
    component: HomeView
  },
  {
    path: 'about',
    name: 'about',
    component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  },
  {
    path: 'administrators',
    name: 'administrators',
    component: () => import(/* webpackChunkName: "about" */ '../views/Administrators.vue')
  },
  {
    path: 'index',
    name: 'index',
    component: IndexView
  },
  {
    path: 'zhanghao',
    name: 'zhanghao',
    component: ZhanghaoView
  },
  {
    path: 'zhanginfo',
    name: 'zhanginfo',
    component: ZhanginfoView
  },
  {
    path: 'newlist',
    name: 'newlist',
    component: NewlistView
  },
  {
    path: 'feedback',
    name: 'feedback',
    component: FeedbackView
  },
      {
        path: 'draft',
        name: 'draft',
        component: DrafView
      }]

},
  {
    path: '/quilledit',
    name: 'quill页面',
    component: QuillEditor
  },

  {
    path: '/editbox',
    name: 'editbox页面',
    component: EditBox
  },

  {
    path: '/draftsbox',
    name: 'draftsbox页面',
    component: DraftsBox
  },
  { path: '/newsdetail', component: NewsDatil },
  { path: '/feedbackpage', component: FeedbackPage },
  {path: '/home', component: HomePage},
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
